namespace SB2.Core;

public class DisplayColumnListDto : List<DisplayColumnDto>
{
    public DisplayColumnListDto(List<DisplayColumnDto> list)
    {
        if (list == null) list = new List<DisplayColumnDto>();
        list.ForEach(m => this.Add(m));
    }
    public string GetSelectFields()
    {
        var select = string.Join(" , ", this.Select(m => m.FieldName).Where(m => !string.IsNullOrEmpty(m)));
        return string.IsNullOrEmpty(select) ? " 1 as no " : select;
    }
    /// <summary>
    /// 获取显示列
    /// TODO： 用户配置项目 显示项目 排序方式 列顺序等
    /// </summary>
    /// <returns></returns>
    public List<DisplayColumnDto> GetDisplayColumnDtos()
    {
        return this;
    }
}
